package com.ybwh.springboot2.sharding5.controller;

import com.ybwh.springboot2.common.RespData;
import com.ybwh.springboot2.sharding5.service.BaiduUidService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Set;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author saytime
 * @since 2018-12-06
 */
@Slf4j
@Api(tags = "百度uid雪花算法")
@Controller
@RequestMapping("/baiduuid")
public class BaiduUidController {

    @Resource
    private BaiduUidService baiduUidService;


    @ApiOperation(value = "批量取雪花id")
    @ResponseBody
    @RequestMapping(value = "/batchGetSnowFlakeId", method = RequestMethod.GET)
    public RespData<Set<Long>> batchGetSnowFlakeId(@ApiParam(value = "取的ID个数", defaultValue = "1") @RequestParam(value = "count", required = false, defaultValue = "1") int count) {
        return RespData.successResp(baiduUidService.batchGetSnowFlakeId(count));
    }


}
